<div class="bjui-pageHeader">
    <div class="pull-right">
        <button class="btn-default" data-icon="plus" title="增加优惠券" data-toggle="tooltip" data-placement="left" onclick="createDialog('{:U("Forms/coupon")}', '增加优惠券', 'coupon', {width:600,height:450})" ></button>
        <a href="{:U('index/save')}" class="btn btn-default" data-toggle="doajaxchecked" data-icon="remove" data-callback="callbackRefres" data-confirm-msg="要删除全部选中的吗??" data-idname="id" data-group="ids"></a>
        <button class="btn-default" data-icon="refresh" onclick="$.CurrentNavtab.navtab('refresh')"></button>
    </div>
    <form id="pagerForm" data-toggle="ajaxsearch" data-loadingmask="true" action="{:U('coupon')}" method="post">
        <input type="hidden" name="pageSize" value="{:I('param.pageSize')}" />
        <input type="hidden" name="pageCurrent" value="{:I('param.pageCurrent')}" />
        <input type="hidden" name="orderField" value="{:I('param.orderField')}" />
        <input type="hidden" name="orderDirection" value="{:I('param.orderDirection')}" />
        <div class="bjui-searchBar">
            <label>券名:</label>
            <input type="text" name="name" value="{:I('name')}" />
            <label>发放方式:</label>
            <select name="type" data-toggle="selectpicker">
                <option value="">--请选择--</option>
                <option value="1">按用户发放</option>
                <option value="2">注册发放</option>
                <option value="3">邀请发放</option>
                <option value="4">线下发放</option>
            </select>
            <button type="submit" class="btn-default" data-icon="search">查询</button>
            <a class="btn btn-orange" href="javascript:;" data-toggle="reloadsearch" data-clear-query="true" data-icon="undo">清空查询 </a>
        </div>
    </form>
</div>
<div class="bjui-pageContent tableContent">
    <table class="table table-bordered table-hover table-striped table-top" data-selected-multi="false">
        <thead>
        <tr>
            <th width="26"><input type="checkbox" class="checkboxCtrl" data-group="ids" data-toggle="icheck"></th>
            <th>优惠券名</th>
            <th>发放方式</th>
            <th>面额</th>
            <th>使用需满金额</th>
            <th>发放总数</th>
            <th>已发放数</th>
            <th>已使用</th>
            <th>使用截止日期</th>
            <th>状态</th>
            <th width="160">操作</th>
        </tr>
        </thead>
        <tbody>
        <volist name="list" id="vo">
        <tr>
            <td width="26"><input type="checkbox" value="{$vo.id}" class="checkboxCtrl" name="ids" data-toggle="icheck"></td>
            <td>{$vo.name}</td>
            <td>{:\\Org\\Oa\\prefer::coupon_type($vo['type'])}</td>
            <td>{$vo.value}</td>
            <td>{$vo.consume_money}</td>
            <td><if condition="$vo.num eq '0'">无限制<else/>{$vo.num}</if></td>
            <td>{$vo.send_num}</td>
            <td>1</td>
            <td>{$vo.end_time}</td>
            <if condition="$vo.ck eq '2' and $vo.status eq '0'">
            <td><a href="{:U('Forms/update_ticket_status',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="要暂停这个活动???">进行中</a></td>
            <elseif condition="$vo.ck eq '0'"/>
            <td>未开始</td>
            <elseif condition="$vo.ck eq '1'"/>
            <td>已结束</td>
            <elseif condition="$vo.ck eq '2' and $vo.status eq '1'"/>
            <td><a href="{:U('Forms/update_ticket_status',array('id'=>$vo['id']))}" data-type="get" data-toggle="doajax" data-confirm-msg="要启用这个活动???">已关闭</a></td>
            </if>
            
            <td>
                <eq name="vo['type']" value="1">
                   <button type="button" class="btn-blue" title="发放" onclick="createDialog('{:U("Common/menber", array('type'=>3,"id"=>$vo["id"]))}','发放优惠券', 'fa_coupon', {width:800, height:550})">发</button>
                </eq>
                <eq name="vo['type']" value="4">
                   <button type="button" class="btn-blue" title="生成优惠券码" onclick="createDialog('{:U("Forms/getcode",array("id"=>$vo["id"]))}','生成优惠券码', 'getcode', {width:800, height:550})">码</button>
                </eq>
                <button type="button" class="btn-blue" title="使用情况" onclick="createDialog('{:U("Common/coupon",array("id"=>$vo["id"]))}', '使用情况', 'see_coupon', {width:700, height:500})">使</button>
                <button type="button" class="btn-green" onclick="createDialog('{:U("Forms/coupon",array("id"=>$vo["id"]))}', '编辑优惠券', 'coupon', {width:600,height:450})">改</button>
                <a href="{:U('Forms/del_coupon',array('id'=>$vo['id']))}" data-type="get" class="btn btn-red" data-toggle="doajax" data-confirm-msg="你确定要删除此优惠券吗" >删</a>
            </td>
        </tr>
        </volist>
        </tbody>
    </table>
</div>
<include file="Common/footer" ftype="page" />